import { reactive } from 'vue'

export function useTable() {
    const gridOptions = reactive<any>({
        border: true,
        columnConfig: {
            resizable: true,
        },
        columns: [
            { slots: { default: 'levelNo' }, title: '等级' },
            { field: 'levelName', title: '等级名称' },
            { slots: { default: 'growth' }, title: '成长值' },
            { slots: { default: 'status' }, title: '等级状态' },
            { field: 'updateTime', title: '最后修改时间' },
            { slots: { default: 'operate' }, title: '操作', width: 300 },
        ],
        data: [],
        editConfig: {
            mode: 'row',
            showStatus: true,
            trigger: 'manual',
        },
        height: 530,
        keepSource: true,
        loading: false,
        pagerConfig: {
            currentPage: 1,
            enabled: true,
            pageSize: 10,
            pageSizes: [10, 20, 50, 100, 200, 500],
            total: 0,
        },
        showOverflow: true,
    })

    const btns: any = [
        {
            label: '编辑',
            type: 'primary',
            value: 'edit',
        },
        {
            label: '配置',
            value: 'config',
        },
        {
            label: '删除',
            value: 'delete',
        },
    ]

    return { btns, gridOptions }
}
